package by.pavlyukevich.paymentsystem.util;

import org.apache.commons.lang3.StringUtils;
import org.hibernate.cfg.ImprovedNamingStrategy;

public class CustomNamingStrategy extends ImprovedNamingStrategy {

	private static final long serialVersionUID = -3283029994938928501L;

	@Override
	public String foreignKeyColumnName(final String propertyName,
			final String propertyEntityName, final String propertyTableName,
			final String referencedColumnName) {
		final String base = super.foreignKeyColumnName(propertyName,
				propertyEntityName, propertyTableName, referencedColumnName);
		String s = StringUtils.isNotEmpty(base) ? base + "_id" : base;
		return s;

	}

	@Override
	public String columnName(String columnName) {
		String s = super.columnName(columnName);
		return s;
	}

}
